﻿<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="false" CodeBehind="EditContent.aspx.cs" Inherits="Cms.Web.UI.Admin.EditContent" ValidateRequest="false" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript" src="Admin/js/jquery-ui-1.8.15.custom.min.js"></script>    
    <script type="text/javascript" src="Admin/js/jquery-timepicker-addon.js"></script>    
    <script language="javascript" type="text/javascript" src="Admin/Js/Edit.js"></script>
    <script type="text/javascript" language="javascript" src="Admin/tiny_mce/tiny_mce.js"></script>
    <script language="javascript">
        //<![CDATA[
        function initTinyAutoSave() {
            this.setProgressImage("Admin/tiny_mce/plugins/tinyautosave/images/progress.gif"); 
        }

        function updatePanels(tab) {
            var pnlProperties = document.getElementById("ctl00_body_pnlProperties");
            var pnlContent = document.getElementById("ctl00_body_pnlContent");
            pnlProperties.style.display = "none";
            pnlContent.style.display = "none";
            switch (tab) {
                case "properties":
                    pnlProperties.style.display = "";
                    break;
                case "content":
                    pnlContent.style.display = "";
                    break;
            }
        }

        var txtName;
        var txtStartPublishing;
        var txtEndPublishing;

        var originalName;
        var originalStartPublishing;
        var originalEndPublishing;
        var originalSelectedCategories;
        var originalSelectedAllowedAdminGroups;
        var originalSelectedDeniedAdminGroups;
        var originalSelectedRequiredUserGroups;

        function init() {
            txtName = document.getElementById("ctl00_body_txtName");
            txtStartPublishing = document.getElementById("ctl00_body_txtStartPublishing");
            txtEndPublishing = document.getElementById("ctl00_body_txtEndPublishing");
            setupDatePicker(txtStartPublishing);
            setupDatePicker(txtEndPublishing);
            originalName = txtName.value;
            originalStartPublishing = txtStartPublishing.value;
            originalEndPublishing = txtEndPublishing.value;
            originalSelectedCategories = cms.Edit.GetSelectedCheckboxValues("ctl00_body_tdCategories");
            originalSelectedAllowedAdminGroups = cms.Edit.GetSelectedCheckboxValues("ctl00_body_tdAllowedAdminGroups");
            originalSelectedDeniedAdminGroups = cms.Edit.GetSelectedCheckboxValues("ctl00_body_tdDeniedAdminGroups");
            originalSelectedRequiredUserGroups = cms.Edit.GetSelectedCheckboxValues("ctl00_body_tdAllowedUserGroups");
        }

        function isDirty() {
            var value = originalName != txtName.value ||
	                    originalStartPublishing != txtStartPublishing.value ||
	                    originalEndPublishing != txtEndPublishing.value ||
	                    originalSelectedCategories != cms.Edit.GetSelectedCheckboxValues("ctl00_body_tdCategories") ||
	                    originalSelectedAllowedAdminGroups != cms.Edit.GetSelectedCheckboxValues("ctl00_body_tdAllowedAdminGroups") ||
	                    originalSelectedDeniedAdminGroups != cms.Edit.GetSelectedCheckboxValues("ctl00_body_tdDeniedAdminGroups") ||
	                    originalSelectedRequiredUserGroups != cms.Edit.GetSelectedCheckboxValues("ctl00_body_tdRequiredUserGroups");
            document.getElementById("ctl00_tabs_hidIsDirty").value = value;
            return value;
        }

        function updateButtons() {
            document.getElementById("ctl00_buttons_lbSave").style.display = "inline";
            var lbContinue = document.getElementById("ctl00_buttons_lbContinue");
            if (lbContinue)
                lbContinue.style.display = "none";
        }

        function initDateTimePickers() {
            txtStartPublishing = document.getElementById("ctl00_body_txtStartPublishing");
            txtEndPublishing = document.getElementById("ctl00_body_txtEndPublishing");
            setupDatePicker(txtStartPublishing);
            setupDatePicker(txtEndPublishing);
        }
        //]]>
    </script>
    <link type="text/css" href="Admin/css/jquery-ui-1.8.16.custom.css" rel="Stylesheet" />	
    <link type="text/css" href="Admin/css/DateTimePicker.css" rel="Stylesheet" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="buttons" runat="server">
    <asp:LinkButton ID="lbSave" runat="server" OnClick="lbSave_Click" CssClass="orangeButton"><span id="lbl1" runat="server"><span id="lbl2" runat="server"><img id="img1" runat="server" src="Admin/Img/icons/disk.png" alt="" /><span id="lbl3" runat="server"><cms:LocalizedLiteral ID="llSave" runat="server" /></span></span></span></asp:LinkButton>
    <asp:LinkButton ID="lbContinue" runat="server" OnClick="lbContinue_Click" CssClass="orangeButton"><span id="lbl4" runat="server"><span id="lbl5" runat="server"><img id="img2" runat="server" src="Admin/Img/icons/disk_continue.png" alt="" /><span id="lbl6" runat="server"><cms:LocalizedLiteral ID="llContinue" runat="server" /></span></span></span></asp:LinkButton>
    <asp:LinkButton ID="lbCancel" runat="server" OnClick="lbCancel_Click" CssClass="orangeButton"><span><span><img src="Admin/Img/icons/delete.png" alt="" /><span><cms:LocalizedLiteral ID="llCancel" runat="server" /></span></span></span></asp:LinkButton>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="tabs" runat="server">
    <asp:UpdatePanel ID="upnlTabs" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
        <ContentTemplate>
            <cms:AdminTabStrip ID="tabStrip" runat="server" SelectedValue="content" OnChange="tabStrip_Click">
                <cms:AdminTabItem ID="tiProperties" runat="server" value="properties" EnabledImage="Admin/Img/icons/page_white_gear.png"><cms:LocalizedLiteral ID="llPropertiesTab" runat="server" /></cms:AdminTabItem>
                <cms:AdminTabItem ID="tiContent" runat="server" value="content" EnabledImage="Admin/Img/icons/page_white_edit.png"><cms:LocalizedLiteral ID="llContentTab" runat="server" /></cms:AdminTabItem>
            </cms:AdminTabStrip>
            <input type="hidden" id="hidIsDirty" runat="server" />
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="body" runat="server">
    <asp:Panel ID="pnlContent" runat="server" CssClass="pnlTab">
        <asp:UpdatePanel ID="upnlContent" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
            <ContentTemplate>
                <table class="editForm">
                    <tr>
                        <td><cms:LocalizedLiteral ID="llTitle" runat="server" />:</td>
                        <td><asp:TextBox ID="txtTitle" runat="server" MaxLength="255" Width="400" /></td>
                    </tr>
                </table>
                <div class="horizontalDivider" style="margin-bottom: 7px; margin-top: 4px; margin-left: 1px; margin-right: 3px;"></div>
                <asp:TextBox ID="txtContent" runat="server" TextMode="MultiLine" width="100%" Height="600" />
            </ContentTemplate>
        </asp:UpdatePanel>
        <div class="pnlTabOverlay"></div>
    </asp:Panel>

    <asp:Panel ID="pnlProperties" runat="server" CssClass="pnlTab">
        <asp:UpdatePanel ID="upnlProperties" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
            <ContentTemplate>
                <table class="editForm">
                    <tr>
                        <td style="width: 250px;"><cms:LocalizedLiteral ID="llName" runat="server" />:</td>
                        <td><asp:TextBox ID="txtName" runat="server" MaxLength="255" Width="400" /></td>
                    </tr>
                    <tr>
                        <td><cms:LocalizedLiteral ID="llStartPublishing" runat="server" />:</td>
                        <td><asp:TextBox ID="txtStartPublishing" runat="server" /></td>
                    </tr>
                    <tr>
                        <td><cms:LocalizedLiteral ID="llEndPublishing" runat="server" />:</td>
                        <td><asp:TextBox ID="txtEndPublishing" runat="server" /></td>
                    </tr>
                </table>
                <div class="adminPageSectionDivider"></div>
                <div style="font-size:16px; margin-top: 20px; padding-left: 2px;"><cms:LocalizedLiteral id="llAdvancedSettingsHeader" runat="server" /></div>
                <span class="editFormSubheader"><cms:LocalizedLiteral ID="llCategoriesAndSortingHeader" runat="server" /></span>
                <table class="editForm">
                    <tr id="trCategories" runat="server" valign="top">
                        <td style="width: 250px;"><cms:LocalizedLiteral ID="llCategories" runat="server" />:</td>
                        <td id="tdCategories" style="padding-bottom: 8px;"><cms:CategorySelector id="csCategories" runat="server" ShowTabOverlay="true" /></td>
                    </tr>
                    <tr>
                        <td><cms:LocalizedLiteral ID="llSortKey" runat="server" />:</td>
                        <td><asp:TextBox ID="txtSortKey" runat="server" MaxLength="255" Width="400" /></td>
                    </tr>
                </table>
                <span class="editFormSubheader"><cms:LocalizedLiteral ID="llUserAccessControlHeader" runat="server" /></span>
                <table class="editForm">
                    <tr id="trRequiredUserGroups" runat="server" valign="top">
                        <td style="width: 250px;"><cms:LocalizedLiteral ID="llRequiredUserGroups" runat="server" />:</td>
                        <td id="tdRequiredUserGroups"><cms:UserGroupSelector id="gsRequiredUserGroups" runat="server" ShowTabOverlay="true" /></td>
                    </tr>
                </table>
                <span class="editFormSubheader"><cms:LocalizedLiteral ID="llAdministratorAccessControlHeader" runat="server" /></span>
                <table class="editForm">
                    <tr id="trAllowedAdministratorGroups" runat="server" valign="top">
                        <td style="width: 250px;"><cms:LocalizedLiteral ID="llAllowedAdministratorGroups" runat="server" />:</td>
                        <td id="tdAllowedAdminGroups"><cms:AdministratorGroupSelector id="gsAllowedAdministratorGroups" runat="server" ShowTabOverlay="true" /></td>
                    </tr>
                    <tr id="trDeniedAdministratorGroups" runat="server" valign="top">
                        <td><cms:LocalizedLiteral ID="llDeniedAdministratorGroups" runat="server" />:</td>
                        <td id="tdDeniedAdminGroups"><cms:AdministratorGroupSelector id="gsDeniedAdministratorGroups" runat="server" ShowTabOverlay="true" /></td>
                    </tr>
                </table>
            </ContentTemplate>
        </asp:UpdatePanel>
        <div class="pnlTabOverlay"></div>
    </asp:Panel>

    <script language="javascript" type="text/javascript">
        //<![CDATA[
        iLib.Dom.AddListener(window, "load", init);
        cms.Ajax.Init();
        cms.Ajax.AddEndRequestHandler(cms.Edit.HideTabOverlays);
        cms.Ajax.AddEndRequestHandler(initDateTimePickers);
        //]]>
    </script>
</asp:Content>